﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Fish_Atlantis.Account
{
    public partial class UserInfo : System.Web.UI.Page
    {
        static public string username = "";
        public string type;
        DataSet ds;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)//登录时保存在Session的值 
            {
                Response.Write("<script language='javascript'>alert('请登录后再操作！');window.location.href='Login.aspx' ;</script>");
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请登录后再操作！！');location.href='/Account/Login.aspx';</script>");
            }
            else
            {
                ds = Helper.GetDataSet("select * from Users where UserID= "+Session["UserID"].ToString(),"123");
                if (ds.Tables[0].Rows.Count <= 0)
                    Response.Write("<script language='javascript'>alert('错误！');window.location.href='Login.aspx' ;</script>");
                else
                {
                    Text1.Value = "  "+ds.Tables[0].Rows[0]["UserID"].ToString();
                    Text2.Value = "  " + ds.Tables[0].Rows[0]["UserName"].ToString();
                    Text4.Value = "  " + ds.Tables[0].Rows[0]["Email"].ToString();
                    Text5.Value = "  " + ds.Tables[0].Rows[0]["Phonenumber"].ToString();
                    type = ds.Tables[0].Rows[0]["User_Type"].ToString();
                    if (type == "1")
                    { Text3.Value = " 买家"; }
                    else if (type == "2")
                    { Text3.Value = " 卖家";}
                    else if (type == "3")
                    { Text3.Value = " 教授"; }
                    else
                    { Text3.Value = " 未知用户";  }
                }
                    
            }


        }
    }
}